#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 10005;

int n, d;
int a[N];
int f[N << 1], mn[N];
bool dfs(int s) {
  int x = a[s - 1];
  if (s == d) {
    a[s] = n;
    rep(i, 1, s - 1) if (a[i] + x == n) return true;
    return false;
  }
  rep(i, 1, s - 1) f[a[i] + x]++;
  int y = n >> (d - s);
  if ((y << (d - s)) < n) y++;
  rep(i, max(y, x + 1), min(n, x * 2)) {
    if (!f[i]) continue;
    a[s] = i;
    if (dfs(s + 1)) return true;
  }
  rep(i, 1, s - 1) f[a[i] + x]--;
  return false;
}
void solve() {
  if (n == 1) {
    cout << 1 << endl;
    return;
  }
  rep(i, 1, n) f[i] = 0;
  a[1] = 1, f[1] = 1;
  d = mn[n];
  while (!dfs(2)) d++;
  rep(i, 1, d) cout << a[i] << " \n"[i == d];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  mn[1] = 1;
  rep(i, 1, 10000) mn[i] = mn[i >> 1] + 1;
  a[1] = 1;
  while (cin >> n && n) solve();
  return 0;
}